/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.sonrisas.tools.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DIEGOALV
 */
@Entity
@Table(name = "clinica")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Clinica.findAll", query = "SELECT c FROM Clinica c"),
    @NamedQuery(name = "Clinica.findByIdClinica", query = "SELECT c FROM Clinica c WHERE c.idClinica = :idClinica"),
    @NamedQuery(name = "Clinica.findByNombre", query = "SELECT c FROM Clinica c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Clinica.findByDomicilio", query = "SELECT c FROM Clinica c WHERE c.domicilio = :domicilio"),
    @NamedQuery(name = "Clinica.findByTelefono", query = "SELECT c FROM Clinica c WHERE c.telefono = :telefono"),
    @NamedQuery(name = "Clinica.findByFax", query = "SELECT c FROM Clinica c WHERE c.fax = :fax"),
    @NamedQuery(name = "Clinica.findByEmail", query = "SELECT c FROM Clinica c WHERE c.email = :email"),
    @NamedQuery(name = "Clinica.findByCodigopostal", query = "SELECT c FROM Clinica c WHERE c.codigopostal = :codigopostal"),
    @NamedQuery(name = "Clinica.findBySlogan", query = "SELECT c FROM Clinica c WHERE c.slogan = :slogan"),
    @NamedQuery(name = "Clinica.findByActivoClinica", query = "SELECT c FROM Clinica c WHERE c.activoClinica = :activoClinica"),
    @NamedQuery(name = "Clinica.findByIdUsuario", query = "SELECT c FROM Clinica c WHERE c.idUsuario = :idUsuario"),
    @NamedQuery(name = "Clinica.findByFechaCreacion", query = "SELECT c FROM Clinica c WHERE c.fechaCreacion = :fechaCreacion"),
    @NamedQuery(name = "Clinica.findByFechaModificacion", query = "SELECT c FROM Clinica c WHERE c.fechaModificacion = :fechaModificacion")})
public class Clinica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idClinica")
    private Integer idClinica;
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "domicilio")
    private String domicilio;
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "fax")
    private String fax;
    @Column(name = "email")
    private String email;
    @Column(name = "codigopostal")
    private String codigopostal;
    @Lob
    @Column(name = "logo")
    private byte[] logo;
    @Column(name = "slogan")
    private String slogan;
    @Basic(optional = false)
    @Column(name = "activoClinica")
    private boolean activoClinica;
    @Basic(optional = false)
    @Column(name = "IdUsuario")
    private int idUsuario;
    @Column(name = "FechaCreacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaCreacion;
    @Column(name = "FechaModificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaModificacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idClinica")
    private List<Pedidolmaterial> pedidolmaterialList;
    @JoinColumn(name = "idUbigeo", referencedColumnName = "idUbigeo")
    @ManyToOne(optional = false)
    private Ubigeo idUbigeo;

    public Clinica() {
    }

    public Clinica(Integer idClinica) {
        this.idClinica = idClinica;
    }

    public Clinica(Integer idClinica, boolean activoClinica, int idUsuario) {
        this.idClinica = idClinica;
        this.activoClinica = activoClinica;
        this.idUsuario = idUsuario;
    }

    public Integer getIdClinica() {
        return idClinica;
    }

    public void setIdClinica(Integer idClinica) {
        this.idClinica = idClinica;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDomicilio() {
        return domicilio;
    }

    public void setDomicilio(String domicilio) {
        this.domicilio = domicilio;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCodigopostal() {
        return codigopostal;
    }

    public void setCodigopostal(String codigopostal) {
        this.codigopostal = codigopostal;
    }

    public byte[] getLogo() {
        return logo;
    }

    public void setLogo(byte[] logo) {
        this.logo = logo;
    }

    public String getSlogan() {
        return slogan;
    }

    public void setSlogan(String slogan) {
        this.slogan = slogan;
    }

    public boolean getActivoClinica() {
        return activoClinica;
    }

    public void setActivoClinica(boolean activoClinica) {
        this.activoClinica = activoClinica;
    }

    public int getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(int idUsuario) {
        this.idUsuario = idUsuario;
    }

    public Date getFechaCreacion() {
        return fechaCreacion;
    }

    public void setFechaCreacion(Date fechaCreacion) {
        this.fechaCreacion = fechaCreacion;
    }

    public Date getFechaModificacion() {
        return fechaModificacion;
    }

    public void setFechaModificacion(Date fechaModificacion) {
        this.fechaModificacion = fechaModificacion;
    }

    @XmlTransient
    public List<Pedidolmaterial> getPedidolmaterialList() {
        return pedidolmaterialList;
    }

    public void setPedidolmaterialList(List<Pedidolmaterial> pedidolmaterialList) {
        this.pedidolmaterialList = pedidolmaterialList;
    }

    public Ubigeo getIdUbigeo() {
        return idUbigeo;
    }

    public void setIdUbigeo(Ubigeo idUbigeo) {
        this.idUbigeo = idUbigeo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idClinica != null ? idClinica.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Clinica)) {
            return false;
        }
        Clinica other = (Clinica) object;
        if ((this.idClinica == null && other.idClinica != null) || (this.idClinica != null && !this.idClinica.equals(other.idClinica))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Clinica[ idClinica=" + idClinica + " ]";
    }
    
}
